#pragma once

#include "dfize.h"

class CTile;

class CTriangleSelector : public ITriangleSelector
{
public:

	CTriangleSelector(CTile *tile);
	CTriangleSelector(aabbox3df box);

	void getTriangles(triangle3df* triangles, s32 arraySize, s32& outTriangleCount, 
		const matrix4* transform=0) const;

	void getTriangles(triangle3df* triangles, s32 arraySize, s32& outTriangleCount, 
		const aabbox3d<f32>& box, const core::matrix4* transform=0) const;

	virtual void getTriangles(triangle3df* triangles, s32 arraySize,
		s32& outTriangleCount, const core::line3d<f32>& line, 
		const core::matrix4* transform=0) const;

	//! Returns amount of all available triangles in this selector
	virtual s32 getTriangleCount() const;

	//! Return the scene node associated with a given triangle.
	virtual const ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const {/* printf("getSceneNodeForTriangle\n");*/ return (ISceneNode*)Tile; }

	virtual void update(void) const;

protected:

	mutable array<core::triangle3df> Triangles;

	CTile *Tile;
};